Create Data Sources – SQL Server

SQL Server driver is not available by default while configuring a datasource on WebLogic. Hence we need to follow the below steps:

Registering Driver Class and Description

Add the following code snippet at the mentioned file.

This snippet contains a description of Driver Class and the proper use of it inside Oracle Weblogic Driver declaration.

$WL_HOME/server/lib/jdbcdrivers.xml (e.g. /scratch/oipa/Oracle/Middleware/Oracle_Home/wlserver/server/lib/jdbcdrivers.xml)

/scratch/oipa/Oracle/Middleware/Oracle_Home/wlserver/server/lib/jdbcdrivers.xml

<Driver
Database="MS SQL Server"
Vendor="Microsoft"
Type="Type 4"
DatabaseVersion="2005 and later"
ForXA="false"
ClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
URLHelperClassname="weblogic.jdbc.utils.MSSQL2005JDBC4DriverURLHelper"
TestSql="SELECT 1">
<Attribute Name="DbmsName" Required="true" InURL="true"/>
<Attribute Name="DbmsHost" Required="true" InURL="true"/>
<Attribute Name="DbmsPort" Required="true" InURL="true" DefaultValue="1433"/>
<Attribute Name="DbmsUsername" Required="true" InURL="false"/>
<Attribute Name="DbmsPassword" Required="true" InURL="false"/>
</Driver>

Note: Post these and restart WebLogic Admin.

Create the Data Source for ADMINSERVERDS

  1. Select EditTree >Services> Data Sources > New.
    1. Enter the Name. This name can be anything, but has to be unique for the entire WebLogic server. If you have more than one OIPA instance on the server, then each instance should have a unique name.

    2. Change the JNDI Name to ADMINSERVERDS. This name cannot be anything other than ADMINSERVERDS.

    3. Select the target server.

    4. Data Source Type > Generic Data Source

    5. DataBase Type > MS SQL Server

    6. Database Driver > Microsoft's MS SQL Server Driver (Type 4) Versions:2005 and later

    7. Enter the Database Name.

    8. Enter the Host Name of the database server.

    9. Enter the Port number of the database server.

    10. Enter the Database user name. This can be obtained from the database administrator who installed the databases.

    11. Enter both password entries. This can be obtained from the database administrator who installed the databases.

    12. Select Create.

  2. On the next page Test Database Connection with the URL as example: jdbc:sqlserver://fsgbu-mum-420.snbomprshared1.gbucdsint02bom.oraclevcn.com:1600

  3. Test the database connection.

After Saving

Create the Data Source for ADMINSERVERRESOURCEDS

  1. Select EditTree >Services> Data Sources > New.
    1. Enter the Name. This name can be anything, but has to be unique for the entire WebLogic server. If you have more than one OIPA instance on the server, then each instance should have a unique name.

    2. Change the JNDI Name to ADMINSERVERRESOURCEDS. This name cannot be anything other than ADMINSERVERRESOURCEDS.

    3. Select the target server.

    4. Data Source Type > Generic Data Source

    5. DataBase Type > MS SQL Server

    6. Database Driver > Microsoft's MS SQL Server Driver (Type 4) Versions:2005 and later

    7. Enter the Database Name.

    8. Enter the Host Name of the database server.

    9. Enter the Port number of the database server.

    10. Enter the Database user name. This can be obtained from the database administrator who installed the databases.

    11. Enter both password entries. This can be obtained from the database administrator who installed the databases.

    12. Select Create.

  2. On the next page Test Database Connection with the URL as example: jdbc:sqlserver://fsgbu-mum-420.snbomprshared1.gbucdsint02bom.oraclevcn.com:1600.
  3. Test the database connection.

Create the Data Source for ADMINSERVERSEARCHDS

  1. Select EditTree >Services> Data Sources > New.
    1. Enter the Name. This name can be anything, but has to be unique for the entire WebLogic server. If you have more than one OIPA instance on the server, then each instance should have a unique name.

    2. Change the JNDI Name to ADMINSERVERSEARCHDS. This name cannot be anything other than ADMINSERVERSEARCHDS.

    3. Select the target server.

    4. Data Source Type > Generic Data Source

    5. DataBase Type > MS SQL Server

    6. Database Driver > Microsoft's MS SQL Server Driver (Type 4) Versions:2005 and later

    7. Enter the Database Name.

    8. Enter the Host Name of the database server.

    9. Enter the Port number of the database server.

    10. Enter the Database user name. This can be obtained from the database administrator who installed the databases.

    11. Enter both password entries. This can be obtained from the database administrator who installed the databases.

    12. Select Create.

  2. On the next page Test Database Connection with the URL as example: jdbc:sqlserver://fsgbu-mum-420.snbomprshared1.gbucdsint02bom.oraclevcn.com:1600.

  3. Test the database connection.

Create Data Source for ADMINSERVERREADONLYDS

  1. Select EditTree >Services> Data Sources > New.
    1. Enter the Name. This name can be anything, but has to be unique for the entire WebLogic server. If you have more than one OIPA instance on the server, then each instance should have a unique name.

    2. Change the JNDI Name to ADMINSERVERREADONLYDS. This name cannot be anything other than ADMINSERVERREADONLYDS.

    3. Select the target server.

    4. Data Source Type > Generic Data Source

    5. DataBase Type > MS SQL Server

    6. Database Driver > Microsoft's MS SQL Server Driver (Type 4) Versions:2005 and later

    7. Enter the Database Name.

    8. Enter the Host Name of the database server.

    9. Enter the Port number of the database server.

    10. Enter the Database user name. This can be obtained from the database administrator who installed the databases.

    11. Enter both password entries. This can be obtained from the database administrator who installed the databases.

    12. Select Create.

  2. On the next page Test Database Connection with the URL as example: jdbc:sqlserver://fsgbu-mum-420.snbomprshared1.gbucdsint02bom.oraclevcn.com:1600.
  3. Test the database connection.

For SQL Server

When the encrypt property is set to true and the trustServerCertificate property is set to true, the Microsoft JDBC Driver for SQL Server won't validate the SQL Server TLS certificate. This setting is common for allowing connections in test environments, such as where the SQL Server instance has only a self-signed certificate.

jdbcUrl = jdbc:sqlserver://<host>:<port>;DatabaseName=<databasename>;encrypt=true;trustServerCertificate=true